Automated preventive and predictive maintenance of downhole valves

ABSTRACT

A method of automated preventive and predictive maintenance for downhole valves in a well system includes receiving, at a plurality of first times, first diagnostics data of the plurality of downhole valves, where each downhole valve is at a respective first valve position at a respective first time, and the diagnostics data represents a valve condition of each downhole valve at a respective valve position and at a respective time. The method also includes receiving, at a plurality of second times, second diagnostics data of the plurality of downhole valves, where each downhole valve has been moved from the respective first valve position at the respective first time to a respective second valve position at a respective second time. The first diagnostics data and the second diagnostics data are compared. Based on results of comparing, a valve maintenance operation is selected for each downhole valve.

TECHNICAL FIELD

This disclosure relates to maintenance of downhole valves in a wellsystem.

BACKGROUND

Downhole valves are widely used in well systems to control flows of wellfluid through wellbores. However, several factors such as scale buildup,erosion or corrosion in wells may deteriorate valves and affect valveperformance. For example, moving parts of a valve may become hard tomove or non-movable if the valve remains at the same position for a longperiod of time. Therefore, maintenance operations such as valve repairor replacement are needed to prevent valve failures and extend lifetime.Manually scheduling maintenance operations by an operator can beinefficient and ineffective, especially if downhole valve conditions areunknown or there are a large number of valves in a well system.

SUMMARY

This disclosure relates to automated preventive and predictivemaintenance of downhole valves.

In some aspects, a computer-implemented method is in a well systemincluding a plurality of downhole valves. Each downhole valve ispositioned below a surface and in a wellbore included in the wellsystem. Each downhole valve controls flow of well fluid through thewellbore. The computer-implemented method includes receiving, at aplurality of first times and by one or more processors, firstdiagnostics data of the plurality of downhole valves, where eachdownhole valve is at a respective first valve position at a respectivefirst time, and the diagnostics data represents a valve condition ofeach downhole valve at a respective valve position and at a respectivetime; receiving, at a plurality of second times and by the one or moreprocessors, second diagnostics data of the plurality of downhole valves,where each downhole valve has been moved from the respective first valveposition at the respective first time to a respective second valveposition at a respective second time; comparing, by the one or moreprocessors; the first diagnostics data and the second diagnostics data;and based on results of comparing the first diagnostics data and thesecond diagnostics data; selecting, by the one or more processors, avalve maintenance operation for each downhole valve.

This, and other aspects, can include one or more of the followingfeatures. The method can also include receiving, at a plurality of thirdtimes and by one or more processors, third diagnostics data of theplurality of downhole valves, where each downhole valve is at therespective first valve position at a respective third time; receiving,at a plurality of fourth times and by the one or more processors, fourthdiagnostics data of the plurality of downhole valves, where eachdownhole valve has been moved from the respective first valve positionat the respective third time to the respective second valve position ata respective fourth time; comparing, by the one or more processors, thefirst diagnostics data and the third diagnostics data; comparing, by theone or more processors, the second diagnostics data and the fourthdiagnostics data; and based on results of comparing the firstdiagnostics data and the third diagnostics data and comparing the seconddiagnostics data and the fourth diagnostics data, scheduling, by the oneor more processors, a second valve maintenance operation for eachdownhole valve at a respective future time. Each downhole valve can besequentially moved from the respective first valve position to therespective second valve position. After collecting the seconddiagnostics data at each downhole valve at each respective second valveposition, each downhole valve can be returned to the respective firstvalve position. The plurality of downhole valves can be choke valves.The diagnostics data can include at least one of valve attribute data,well production attribute data, or fault detection attribute data. Thevalve attribute data can include at least one of valve position or linepressure. The valve position can include at least one of open or closedposition. The line pressure can include a well fluid pressure in a flowpath controlled by the valve, or a fluid flow rate through the valve.The well production attribute data can include at least one of well headpressure at the surface of the well system or well fluid production ratethrough the wellbore. The fault detection attribute data can indicate atleast one of leakage in a valve actuator, looseness in a valve assembly,or a hydraulic failure in the valve. Comparing the first diagnosticsdata to the second diagnostics data can include performing a correlationoperation on the first diagnostics data and the second diagnostics data.The valve maintenance operation can be at least one of replacing thevalve, stopping flow of well fluid through the valve, repairing thevalve, or capturing the diagnostic data. For each downhole valve, therespective first valve position, the respective first time, therespective second valve position, and the respective second time can bestored. An alert based on the results of comparing the first diagnosticsdata and the second diagnostics data can be provided. The well systemcan be a multilateral well comprising a mother wellbore and multiplelateral wellbores, the mother wellbore and each lateral wellborecomprising at least one of the plurality of downhole valves. Arespective reliability for each downhole valve can be determined basedon the results of comparing the first diagnostics data and the thirddiagnostics data and comparing the second diagnostics data and thefourth diagnostics data, where the reliability indicates a probabilitythat the valve would fail during a predetermined duration of time. Therespective future time for the second valve maintenance operation foreach downhole valve can be determined based on the respectivereliability. For each downhole valve the respective third time is threemonths from the respective first time, and the respective fourth time isthree months from the respective second time.

In some aspects, a non-transitory, computer-readable medium stores oneor more instructions executable by a computer system to performoperations in a well system including a plurality of downhole valves.Each downhole valve is positioned below a surface and in a wellboreincluded in the well system. Each downhole valve controls flow of wellfluid through the wellbore. The operations include receiving, at aplurality of first times, first diagnostics data of the plurality ofdownhole valves, where each downhole valve is at a respective firstvalve position at a respective first time, and the diagnostics datarepresents a valve condition of each downhole valve, at a respectivevalve position and at a respective time; receiving, at a plurality ofsecond times, second diagnostics data of the plurality of downholevalves, where each downhole valve has been moved from the respectivefirst valve position, at the respective first time, to a respectivesecond valve position, at a respective second time; comparing the firstdiagnostics data and the second diagnostics data; and based on resultsof comparing the first diagnostics data and the second diagnostics data,selecting a valve maintenance operation for each downhole valve.

This, and other aspects, can include one or more of the followingfeatures. The operations can also include receiving, at a plurality ofthird times; third diagnostics data of the plurality of downhole valves,where each downhole valve is at the respective first valve position at arespective third time; receiving, at a plurality of fourth times, fourthdiagnostics data of the plurality of downhole valves, where eachdownhole valve has been moved from the respective first valve positionat the respective third time to the respective second valve position ata respective fourth time; comparing the first diagnostics data and thethird diagnostics data; comparing the second diagnostics data and thefourth diagnostics data; and based on results of comparing the firstdiagnostics data and the third diagnostics data and comparing the seconddiagnostics data and the fourth diagnostics data, scheduling a secondvalve maintenance operation for each downhole valve at a respectivefuture time. The diagnostics data can include at least one of valveattribute data, well production attribute data, or fault detectionattribute data. The valve attribute data can include at least one ofvalve position or line pressure. The valve position can include at leastone of open or closed position. The line pressure can include a wellfluid pressure in a flow path controlled by the valve, or a fluid flowrate through the valve. The well production attribute data can includeat least one of well head pressure at the surface of the well system orwell fluid production rate through the wellbore. The fault detectionattribute data can indicate at least one of leakage in a valve actuator,looseness in a valve assembly, or a hydraulic failure in the valve. Arespective reliability for each downhole valve can be determined basedon the results of comparing the first diagnostics data and the thirddiagnostics data and comparing the second diagnostics data and thefourth diagnostics data, where the reliability indicates a probabilitythat the valve would fail during a predetermined duration of time. Therespective future time for the second valve maintenance operation foreach downhole valve can be determined based on the respectivereliability.

In some aspects; a system includes a computer memory and a hardwareprocessor. The hardware processor is interoperably coupled with thecomputer memory and configured to perform operations in a well systemincluding a plurality of downhole valves. Each downhole valve ispositioned below a surface and in a wellbore included in the wellsystem. Each downhole valve controls flow of well fluid through thewellbore. The operations include receiving, at a plurality of firsttimes and by one or more processors, first diagnostics data of theplurality of downhole valves, where each downhole valve is at arespective first valve position at a respective first time, and thediagnostics data represents a valve condition of each downhole valve ata respective valve position and at a respective time; receiving, at aplurality of second times and by the one or more processors, seconddiagnostics data of the plurality of downhole valves, where eachdownhole valve has been moved from the respective first valve positionat the respective first time to a respective second valve position at arespective second time; comparing, by the one or more processors, thefirst diagnostics data and the second diagnostics data; and based onresults of comparing the first diagnostics data and the seconddiagnostics data, selecting, by the one or more processors, a valvemaintenance operation for each downhole valve.

This, and other aspects, can include one or more of the followingfeatures. The operations also include receiving, at a plurality of thirdtimes and by one or more processors, third diagnostics data of theplurality of downhole valves, where each downhole valve is at therespective first valve position at a respective third time; receiving,at a plurality of fourth times and by the one or more processors, fourthdiagnostics data of the plurality of downhole valves, where eachdownhole valve has been moved from the respective first valve positionat the respective third time to the respective second valve position ata respective fourth time; comparing, by the one or more processors, thefirst diagnostics data and the third diagnostics data; comparing, by theone or more processors, the second diagnostics data and the fourthdiagnostics data; and based on results of comparing the firstdiagnostics data and the third diagnostics data and comparing the seconddiagnostics data and the fourth diagnostics data, scheduling, by the oneor more processors, a second valve maintenance operation for eachdownhole valve at a respective future time. The system can also includemultiple sensors disposed at multiple locations in the wellbore. Thediagnostics data can be determined based on information sensed by themultiple sensors. The diagnostics data can include at least one of valveattribute data, well production attribute data, or fault detectionattribute data. The valve attribute data can include at least one ofvalve position or line pressure. The valve position can include at leastone of open or closed position. The line pressure can include a wellfluid pressure in a flow path controlled by the valve, or a fluid flowrate through the valve. The well production attribute data can includeat least one of well head pressure at the surface of the well system orwell fluid production rate through the wellbore. The fault detectionattribute data can indicate at least one of leakage in a valve actuator,looseness in a valve assembly, or a hydraulic failure in the valve. Arespective reliability for each downhole valve can be determined basedon the results of comparing the first diagnostics data and the thirddiagnostics data and comparing the second diagnostics data and thefourth diagnostics data, where the reliability indicates a probabilitythat the valve would fail during a predetermined duration of time. Therespective future time for the second valve maintenance operation foreach downhole valve can be determined based on the respectivereliability.

The details of one or more implementations of the subject matterdescribed in this disclosure are set forth in the accompanying drawingsand the description below. Other features, aspects, and advantages ofthe subject matter will become apparent from the description, thedrawings, and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an example of an automated preventive andpredictive maintenance to downhole valves (APPMDV) system, according toan implementation.

FIG. 2 is a flowchart of an example method implemented in a preventivedistributed module (PDM) for valve maintenance, according to animplementation.

FIG. 3 is a flowchart of an example method for automated preventive andpredictive maintenance for downhole valves, according to animplementation.

FIG. 4 is a block diagram of an exemplary computer system used toprovide computational functionalities associated with describedalgorithms, methods, functions, processes, flows, and procedures asdescribed in the instant disclosure, according to an implementation.

DETAILED DESCRIPTION

Sub-surface downhole valves can be used to control flows of well fluidin wellbores. For example, downhole valves can be used in oil, gas, orinjection wells. In some cases, a multilateral well can be drilled suchthat hydrocarbons in multiple zones of interest can be produced from asingle well system. The multilateral well can include a mother wellboreand a number of lateral wellbores that are drilled from the motherwellbore. To control flows of well fluid from the lateral wellbores tothe mother wellbore, as well as the fluid flow from the mother wellbore,downhole valves can be used in the lateral wellbores and the motherwellbore.

This disclosure describes automated preventive and predictivemaintenance for downhole valves, in some implementations, sensors aredisposed in downhole valves and at multiple locations in wellbores tomeasure valve conditions and well conditions. As described in thisdisclosure, an automated preventive and predictive maintenance todownhole valves (APPMDV) system integrating sensors can performdiagnostic analysis for the valves using diagnostic data based on sensormeasurements. Based on the diagnostic analysis, the APPMDV system canschedule and perform preventive and predictive maintenance operationsfor the valves. The maintenance operations can be operations such asreplacing the valve, repairing the valve, stopping flow of well fluidthrough the valve, determining that no valve operation need beperformed, collecting diagnostic data or other maintenance operations.In some implementations, the APPMDV system can move a valve to differentvalve positions (for example, open and closed positions) and capturecorresponding diagnostic data. By comparing diagnostic data at differentvalve positions, the APPMDV system can diagnose if the valve has anabnormal condition and select a maintenance operation (for example, avalve repair, replacement or other maintenance operation) to prevent avalve failure. If no abnormal condition is diagnosed, the APPMDV systemcan determine not to perform any maintenance operation. In someimplementations, the APPMDV system can periodically capture diagnosticdata based on a pre-determined maintenance cycle (for example, everythree months or other maintenance cycle duration). By comparingdiagnostic data from a current cycle and a previous cycle, the APPMDVsystem can predict a remaining lifetime of the valve and adjust afrequency of capturing diagnostic data. For example, if a valve has ashort remaining lifetime (that is, the valve is starting to wear),diagnostic data may need to be captured more frequently so that a faultor abnormal condition can be detected early, that is, before asignificant repair or replacement operation becomes necessary. In someimplementations, when a fault or an abnormal condition of the valve isdetected, an impact and severity of the fault or abnormal condition canbe predicted, and a valve replacement or repair can be scheduled andperformed based on the predicted impact and severity.

In sum, the described approach provides a platform to perform diagnosticanalysis for downhole valves and automatically schedule and performproactive maintenance based on the analysis. For example, if a valve isbeginning to wear, a reduced maintenance cycle duration can beautomatically configured so that the valve can be more frequentlymonitored to prevent a valve failure. The proactive maintenance canincrease valve reliability and lifetime. The automated maintenancescheduling can increase operational efficiency and reduces effort ofmanual scheduling by an operator. Moreover, the automated maintenancescheduling capability enables workflow system integration, performancemonitoring and reporting at both site level and field level, and evenenterprise level.

FIG. 1 is a block diagram of an example of an APPMDV system 100,according to an implementation. The APPMDV system 100 has sensors 102disposed in downhole valves and wellbores. The sensors 102 are connectedto a preventive distributed module (PDM) 104, a preventive downhole toolmodule (PDTM) 106, and a failure detection module (FDM) 112. The APPMDVsystem 100 also includes a preventive maintenance central module (PMCM)108 and a predictive maintenance module (MAI) 114, together with the PDM104 and the FDM 112, providing information to a workflow module (WFM)110 that defines maintenance schedules and generates maintenance reportsand alerts for manual intervention. As will be understood by those ofordinary skill in the art, each module of the PDM 104, PDTM 106, PMCM108, WFM 110, FDM 112, and PMM 114 can be implemented as computerinstructions stored on a computer-readable media and executable bycomputer systems to perform corresponding operations. Different modulescan be connected to each other, can send instructions to each other, andcan share data, and that these connections allow the different modulesto function collectively to schedule and perform valve maintenances.

In some implementations, the downhole valve can be a choke valve whichcontrols the well fluid flow at a designed flow rate. The fluid flowrate through a choke valve can be determined by an opening size of thevalve, a diameter of a flow path in which the valve is disposed, anupstream fluid pressure and an upstream fluid temperature on the inputpath of the valve. In some implementations; the downhole valve can be acontrol valve, where the flow rate can be proportional to a square rootof a pressure drop between an upstream fluid pressure and a downstreamfluid pressure on the output path of the valve.

The sensors 102 can be disposed at multiple locations in the wellbore,for example, disposed at each downhole valve, measuring the valvecondition and wellbore condition. The APPMDV system can form diagnosticdata based on sensor measurements. The diagnostic data can include, forexample, valve attribute data, well production attribute data, faultdetection attribute data, other diagnostic data, or combinations ofthem. The valve attribute data can include, for example, a valveposition, line pressure, fluid temperature, flow rate of the fluid flowthrough the valve, other diagnostic data, or combinations of them. Thevalve position can indicate a valve opening size, for example, an open,partially open, or closed position. The line pressure can indicate afluid pressure in the flow path controlled by the valve. For example,the sensors 102 can measure the upstream and downstream fluid pressure.The sensors 102 can also measure the upstream and downstream fluidtemperature.

The well production attribute data can include, for example, a well headpressure, a well fluid production rate, other diagnostic data, orcombinations of them. The well head pressure can indicate a pressure ata surface of the wellbore. The well fluid production rate can indicate aflow rate of the well fluid through the wellbore. The fault detectionattribute data can indicate, for example; a leakage in the valveactuator, looseness in the valve assembly and connections, pressurerestrictions, friction diagnostics, pressure or temperature deviations.The fault detection attribution data can also indicate, for example, ahydraulic failure, scale build up, seat tightness, erosion or corrosionin the valve, and other faults. As will be understood by those ofordinary skill in the art, the sensors 102 can also measure otherelectrical or mechanical parameters related to the valve and wellbore.The sensors 102 can connect to the PDM 104, PDTM 106, and FDM 112through wireline or wireless connections. For example, wireless radiosignals can be used to provide communications between the sensors 102and the PDM 104, PDTM 106, and FDM 112.

The PMCM 108 can have a library including information of all downholevalves. The PMCM 108 can be used to configure attributes for each valve,such as the valve position, valve opening size in inches, or valveopening size in percent. Multiple valves can be configured concurrentlyor sequentially. In some implementations, the APPMDV system 100 caninclude information of all valves that belong to different oil and gascompanies. The PMCM 108 can store information in a hierarchicalstructure, for example, a company level, followed by a field level ifeach company has multiple reservoir fields, and followed by a well levelif each field has multiple wells. The PMCM 108 can provide a front enduser interface to an operator for executing, analyzing, or reportingvalve maintenance. The PMCM 108 can also interface with other modules orapplications in an enterprise system that includes the APPMDV system orthat the APPMDV system connects to, for providing or receivinginformation related to valve maintenance. The PMCM 108 can send valveinformation to the WFM 110 so that the WFM 110 can schedule maintenancefor each valve.

The PDM 104 can have similar functions as the PMCM 108 but at a welllevel or field level. For example, the PDM 104 can have information ofall downhole valves within a same well or field. In other words,multiple PDMs can be implemented in the APPMDV system 100, each PDMcorresponding to a well or a field. The PDM 104 can have access to thelibrary in the PMCM 108 and a capability to interface with other modulesor applications in an enterprise system that includes the APPMDV systemor that the APPMDV system connects to. The PDM 104 can be logically andphysically placed at a well site. In some implementations, the PDM 104and PMCM 108 can be connected by a local area network or a wide areanetwork.

The PDM 104 can receive diagnostic data from the sensors 102. In someimplementations, the PDM 104 can receive measurements from the sensors102 and determine diagnostic data based on the received measurements. Tominimize sticking of moving parts of a valve due to setting at the samevalve position for a long period of time, during a normal valvemaintenance, each valve can be moved sequentially to different valvepositions, and the sensors 102 can measure diagnostic data at differentvalve positions. After cycling through the different positions, thevalve can be returned to its original position. The PDM 104 can link thevalve attribute data at different valve positions to the correspondingwell production attribute data.

The PDM 104 can also compare the diagnostic data at different valvepositions by a correlation operation, and determine if the condition atthe valve is normal or abnormal. For example, a valve is initially at anopen position when the PDM 104 collects first diagnostic data. Duringmaintenance, the PDM 104 moves the valve to a half-open position whensecond diagnostic data is collected, and then moves the valve to aclosed position when third diagnostic data is collected. For eachposition, the PDM 104 can examine the corresponding diagnostic data todetermine if the valve is operated as expected. For example, the PDM 104can determine if the measured flow rate is similar to an expected flowrate calculated based on the valve opening size, measured fluid pressureand temperature. If the difference between the measured and expectedflow rate is more than a predetermined threshold, the valve can have anabnormal condition and may need to be repaired, replaced, or othermaintenance operations can be performed. In some implementations, thePDM 104 can compare the three diagnostic data, and, for example,determine if the fluid pressure change due to the valve opening sizechange correlates to or matches the corresponding flow rate change.Based on the diagnostic analysis, the PDM 104 can schedule a maintenanceoperation such as a valve repair or replacement and send the schedule tothe WFM 110.

In some implementations, the PDM 104 can also implement a time basedautomated preventive maintenance, for example, an automated quarterlypreventive maintenance that strokes valves quarterly to prevent stickingof moving parts of a valve due to the long period of setting at the sameposition. The valve can be moved to different positions during theautomated preventive maintenance.

FIG. 2 is a flowchart of an example method 200 implemented in a PDM forvalve maintenance, according to an implementation. For clarity ofpresentation, the description that follows generally describes method200 in the context of the other figures in this disclosure. However, itwill be understood that method 200 may be performed, for example, by anysuitable system, environment, software, and hardware, or a combinationof systems, environments, software, and hardware as appropriate. In someimplementations, various steps of method 200 can be run in parallel, incombination, in loops, or in any order.

At 202, a valve is at an initial valve position with a steady statevalve flow rate, well head pressure, and valve line pressure (that is,fluid pressure). In some implementations, the PDM 104 can store thediagnostic data corresponding to the initial valve position. From 202,method 200 proceeds to 204.

At 204, the PDM 104 determines whether there is a change in the linepressure. In some implementations, the valve sensor can periodically ornon-periodically measure the line pressure and send the measurements tothe PDM 104 so that the PDM 104 can determine if there is a change inthe line pressure. If it is determined that there is no change in theline pressure, the method 200 returns to 202 and continues to stay atthe initial valve position. Otherwise, if it is determined that there isa change in the line pressure, the method 200 proceeds to 206.

At 206, the PDM 104 determines whether the line pressure change detectedat 204 is a planned change, for example, due to a planned quarterlymaintenance. The planned quarterly maintenance can be a time basedautomated preventive maintenance that strokes valves quarterly toprevent sticking of moving parts of a valve due to the long period ofsetting at the same position. If it is determined that the line pressurechange is due to the scheduled quarterly maintenance, the method 200proceeds to 208 to perform the scheduled maintenance and then proceedsto 210. Otherwise, the method 200 directly proceeds to 210.

At 210, the PDM 104 determines whether a valve movement needs to betriggered to capture diagnostic data. If it is determined that no valvemovement is scheduled, the method 200 proceeds to 212 to performoperations such as check diagnostic data, surface unit pump, andpressure tank. Otherwise, if it is determined that a valve movement isscheduled to capture diagnostic data, the method 200 proceeds to 214. Insome implementations, the valve movement can be pre-scheduled based on acalendar, for example, once every three months or other maintenancecycle duration. Alternatively, or in addition, the valve movement can beimplemented in response to an operator input.

At 214, the PDM 104 determines a new valve position. In someimplementations, the different valve positions that the valve willsequentially move to for capturing diagnostic data can be predeterminedby, for example, the PMCM 108 or other modules in the APPMDV system.From 214, the method 200 proceeds to 216.

At 216, the PDM determines the fluid flow rate at the new valveposition. For example, the PDM can receive measured flow rate from thevalve sensor. In some implementations, the PDM can receive diagnosticdata at the new valve position from the sensor and store the receiveddiagnostic data. From 216, the method 200 proceeds to 218.

At 218, the PDM can compare the diagnostic data at the new valveposition and the diagnostic data at the initial valve position, anddetermine if the valve has an abnormal condition. If there is anabnormal condition, a report or an alert can be provided on a userinterface to an operator. In some implementations, the PDM can validatethe valve movement based on the diagnostic data. For example, the valveis initially closed, and the new position is an open position. If, asexpected, the flow rate at the open position is larger than the flowrate at the closed position, the movement to the open position can be avalid valve movement. From 218, the method 200 ends at 220. In someimplementations, 214 to 218 can be repeated for all valve positions thatthe valve needs to cycle through. In some implementations, from 220, themethod 200 can return to 202 and repeat 202 to 218 for a next valve.

Following is one example of pseudo code for the operation performed atPDM:

Let Choke Valve n = CVn;   where n=1, 2, 3... Let Choke Valve Position =Pi;   where i=1, 2, 3,   For CVn, find attributes:     Date: HH:MM, Day,Month, Year     Flow Rate=Fri     Header Pressure Hpi     LinePressure=LPi   Report Attributes   Set CVn position to position i+1  Report Attributes Report Attributes  Set CVn Position to position i  Report Attributes   Function= Compare     CVn Pi     Header PressureHpi     Line Pressure=LPi Function=Validate     Pi;Hpi, Lpi to Pi+1,Hpi+1 , LPi+1     if Hpi<Hpi+1, and LPi<LPi+1 then Pi+1 is reported.    else check Fri     if Fri < Fri+1     then report Pi+1   ContinueIn the above pseudo code, the valve is sequentially moved to multiplevalve positions, and the PDM validates the valve movement based on themeasured diagnostic data.

Turning back to FIG. 1, the APPMDV system 100 can also include a PDTM106 connecting to the downhole sensors and valves. The PDTM 106 caninterface to the PDM 104 and instruct downhole sensors and valves toexecute tasks defined by the PDM (for example, priority based schedulingexecution defined by the PDM), address priorities in task executions,address schedule events and unscheduled events. In some implementations,the PDTM 106 can execute tasks defined by the PMCM 108, for example,priority based scheduling execution defined by the PMCM. In addition,the PDTM 106 addresses historical tracking for a particular well,provides trends on diagnostic data, and addresses planning for valveattributes.

The PMM 114 can forecast valve health and determine potential valvefailures over time based on a library of complex physical valve modelsdeveloped under different stress conditions as well as a library ofvalve life estimation models. The physical valve models and lifeestimation models can consider effects of a multi-phase flow, pressureand temperature, flow velocity, h2s, crude oil type as well as minimumconstraints mandated by industry standards for an instrumentedequipment.

In some implementations, the PMM 114 can forecast the valve heath basedon degradation of the valve. In some implementations, diagnostic data ofa valve can be periodically captured based on a pre-determinedmaintenance cycle (for example, every three months or other maintenancecycle duration). By comparing diagnostic data from a current cycle and aprevious cycle, the degradation of the valve can be estimated. Forexample, on January 1^(st), the valve is moved from an open position toa closed position and back to the open position, and diagnostic datacorresponding to the open and closed position are captured. On April1^(st), the valve repeats the same operation as it did three months ago,that is, moving from an open position to a closed position and back tothe open position, and capturing diagnostic data corresponding to theopen and closed position. The PMM 114 can compare the diagnostic data atthe open position on January 1^(st) and April 1^(st) to see if there aresignificant changes. For example, if the flow rate at the open positionon April 1^(st) is lower than that on January 1^(st) more than apredetermined threshold, it can be an indication that the valve isbeginning to wear. Similarly, the PMM 114 can compare the diagnosticdata at the closed position on January 1^(st) and April 1^(st) to see ifthere are significant changes.

In some implementations, an output of the valve life estimation modelcan be a reliability of the valve indicating a probability that thevalve will not fail before a certain duration of time. In other words,the reliability indicates a probability that the remaining lifetime ofthe valve is more than a certain duration of time. For example, assumingthat x is defined as a remaining lifetime of a valve, the probabilitythe remaining lifetime of the valve more than a time duration t, can beexpressed as Probability(x>t). A high reliability indicates that thevalve is in a good condition and a low reliability indicates that thevalve is beginning to wear. Typically, diagnostic data may need to becaptured more frequently to avoid a valve failure if the valve isbeginning to wear. For example, if normal maintenance occurs every threemonths, the PMM 114 can determine the reliability of Probability(x>3months). If this reliability is high, say, 90%, the 3-month normalmaintenance cycle for capturing diagnostic data can be sufficient forthe valve. In some cases, if the valve is in good condition, amaintenance cycle duration longer than the normal cycle duration can beused to reduce maintenance cost. However, if the reliability is low,say, 10%, an increased frequency of capturing diagnostic data, forexample, once every month, may be needed. The PMM 114 can send thereliability to the WFM 110 so that the WFM 110 can dynamically schedulemaintenance for each valve based on individual health condition.

In some implementations, the PMM can also forecast the valve health bycorrelating conditions of multiple valves. For example, if a valve issimilar to twenty other valves and the twenty other valves were found tobe defective, more than likely, that valve will also be affected and anincreased frequency of capturing diagnostic data may be needed so that adefect can be detected early.

The FDM 112 can connect to the downhole sensors 102 and detect faultsand abnormal conditions. Abnormal conditions can be abnormal hydrauliccondition, valve condition, position condition, wellbore conditions andthe well performance condition. For example, an abrupt change inpressure or temperature on a downstream of the valve can be detected.Faults can range from leaks, plugs, sheared parts, loose connections,vibrations or others. Early detections of faults and abnormal conditionsallow for time to repair valves without unplanned shutdowns. The FDM 112can monitor indices that represent performance of the valve components,for example, an actuator status and a positioner status that can monitoractuator data and various aspects of the valve assembly. After a faultor an abnormal condition has been detected, the FDM 112 can send theinformation of the fault or abnormal condition to the PMM 114. The PMM114 can evaluate impact and severity of the detected fault and abnormalcondition and provide the evaluation to the WFM 110. The WFM 110 candynamically schedule maintenance based on the detected faults andabnormal conditions.

The WFM 110 is responsible for scheduling preventive and predictivemaintenance based on the received information from the PDM 104, PMCM108, FDM 112, and PMM 114. For example, the WFM 110 can define theschedule of capturing diagnostic data and performing diagnostic analysisto enable preventive and predictive maintenance. The WFM 110 can alsogenerates reports, actions, and alerts for manual intervention, forexample, on a user interface to an operator.

In some implementations, the PDM 104, PDTM 106, and FDM 112 can beimplemented at a well site, and the PMCM 108, WFM 110, and PMM 114 canbe implemented at a location away from the well and in a centralizedoffice.

FIG. 3 is a flowchart of an example method 300 for automated preventiveand predictive maintenance for downhole valves, according to animplementation. For clarity of presentation, the description thatfollows generally describes method 300 in the context of the otherfigures in this description. However, it will be understood that method300 may be performed, for example, by any suitable system, environment,software, and hardware, or a combination of systems, environments,software, and hardware as appropriate. In some implementations, varioussteps of method 300 can be run in parallel, in combination, in loops, orin any order.

At 302, first diagnostics data of a plurality of downhole valves isreceived at a plurality of first times, where each downhole valve is ata first valve position at a first time. Sensors can be disposed in eachvalve and the wellbore to measure the valve condition and wellcondition. The APPMDV system can capture diagnostics data correspondingto the first valve position based on information measured by thesensors. The diagnostic data can include, for example, valve attributedata, well production attribute data, and valve fault detectionattribute data, other diagnostic data or combinations of them. From 302,method 300 proceeds to 304.

At 304, second diagnostics data of the plurality of downhole valves isreceived at a plurality of second times, where each downhole valve hasbeen moved from the first valve position, at the first time to a secondvalve position, at a second time. The APPMDV system can capturediagnostic data corresponding to the second valve position. For example,the APPMDV system can move the valve from the first position of an openposition to the second position of a closed position. In someimplementations, the valve can be moved to a third position at a thirdtime, a fourth position at a fourth time, and so on. After the valve hascycled through all positions, the valve is returned to its firstposition. From 304, method 300 proceeds to 306.

At 306, the first diagnostics data and the second diagnostics data arecompared. In some implementations, the APPMDV system can perform acorrelation operation on the first and the second diagnostics data. Forexample, if the valve is moved from an open position to a closedposition, the fluid pressure change can be correlated to the fluid flowrate change by checking if the measured flow rate change is similar toan expected flow rate change based on the fluid pressure change. If themeasured flow rate change is significantly different from the expectflow rate change, for example, by an amount more than a predeterminedthreshold, the APPMDV system can determine that there is a valveabnormal condition. From 306, method 300 proceeds to 308.

At 308, based on results of the comparing at 306, a valve maintenanceoperation is selected for each downhole valve. For example, if the valveis determined to have an abnormal condition at 306, the APPMDV systemcan schedule or perform, or both, a valve maintenance operation such asa valve repair, valve replacement, or other maintenance operations.

FIG. 4 is a block diagram of an exemplary computer system 400 used toprovide computational functionalities associated with describedalgorithms, methods, functions, processes, flows, and procedures asdescribed in the instant disclosure, according to an implementation. Theillustrated computer 402 is intended to encompass any computing devicesuch as a server, desktop computer, laptop/notebook computer, wirelessdata port, smart phone, personal data assistant (PDA), tablet computingdevice, one or more processors within these devices, or any othersuitable processing device, including physical or virtual instances (orboth) of the computing device. Additionally, the computer 402 maycomprise a computer that includes an input device, such as a keypad,keyboard, touch screen, or other device that can accept userinformation, and an output device that conveys information associatedwith the operation of the computer 402, including digital data, visual,or audio information (or a combination of information), or a GUI.

The computer 402 can serve in a role as a client, network component, aserver, a database or other persistency, or any other component (or acombination of roles) of a computer system for performing the subjectmatter described in the instant disclosure. The illustrated computer 402is communicably coupled with a network 430. In some implementations, oneor more components of the computer 402 may be configured to operatewithin environments, including cloud-computing-based, local, global, orother environment (or a combination of environments).

At a high level, the computer 402 is an electronic computing deviceoperable to receive, transmit, process, store, or manage data andinformation associated with the described subject matter. According tosome implementations, the computer 402 may also include or becommunicably coupled with an application server, e-mail server, webserver, caching server, streaming data server, business intelligence(BI) server, or other server (or a combination of servers).

The computer 402 can receive requests over network 430 from a clientapplication (for example, executing on another computer 402) and respondto the received requests by processing the said requests in anappropriate software application. In addition, requests may also be sentto the computer 402 from internal users (for example, from a commandconsole or by other appropriate access method), external orthird-parties, other automated applications, as well as any otherappropriate entities, individuals, systems, or computers.

Each of the components of the computer 402 can communicate using asystem bus 403. In some implementations, any or all of the components ofthe computer 402, both hardware or software (or a combination ofhardware and software), may interface with each other or the interface404 (or a combination of both) over the system bus 403, using anapplication programming interface (API) 412 or a service layer 413 (or acombination of the API 412 and service layer 413). The API 412 mayinclude specifications for routines, data structures, and objectclasses. The API 412 may be either computer-language independent ordependent and refer to a complete interface, a single function, or evena set of APIs. The service layer 413 provides software services to thecomputer 402 or other components (whether or not illustrated) that arecommunicably coupled to the computer 402. The functionality of thecomputer 402 may be accessible for all service consumers using thisservice layer. Software services, such as those provided by the servicelayer 413, provide reusable, defined business functionalities through adefined interface. For example, the interface may be software written inJAVA, C++, or other suitable language providing data in extensiblemarkup language (XML) format or other suitable format. While illustratedas an integrated component of the computer 402, alternativeimplementations may illustrate the API 412 or the service layer 413 asstand-alone components in relation to other components of the computer402 or other components (whether or not illustrated) that arecommunicably coupled to the computer 402. Moreover, any or all parts ofthe API 412 or the service layer 413 may be implemented as child orsub-modules of another software module, enterprise application, orhardware module without departing from the scope of this disclosure.

The computer 402 includes an interface 404. Although illustrated as asingle interface 404 in FIG. 4, two or more interfaces 404 may be usedaccording to particular needs, desires, or particular implementations ofthe computer 402. The interface 404 is used by the computer 402 forcommunicating with other systems in a distributed environment, that areconnected to the network 430 (whether illustrated or not). Generally,the interface 404 comprises logic encoded in software or hardware (or acombination of software and hardware) and operable to communicate withthe network 430. More specifically, the interface 404 may comprisesoftware, supporting one or more communication protocols associated withcommunications, such that the network 430, or interface's hardware isoperable to communicate physical signals within and outside of theillustrated computer 402.

The computer 402 includes a processor 405. Although illustrated as asingle processor 405 in FIG. 4, two or more processors may be usedaccording to particular needs, desires, or particular implementations ofthe computer 402. Generally, the processor 405 executes instructions andmanipulates data to perform the operations of the computer 402 and anyalgorithms, methods, functions, processes, flows, and procedures asdescribed in the instant disclosure.

The computer 402 also includes a memory 406 that holds data for thecomputer 402 or other components (or a combination of both) that can beconnected to the network 430 (whether illustrated or not). For example,memory 406 can be a database storing data consistent with thisdisclosure. Although illustrated as a single memory 406 in FIG. 4, twoor more memories may be used according to particular needs, desires, orparticular implementations of the computer 402 and the describedfunctionality. While memory 406 is illustrated as an integral componentof the computer 402, in alternative implementations, memory 406 can beexternal to the computer 402.

The application 407 is an algorithmic software engine providingfunctionality according to particular needs, desires, or particularimplementations of the computer 402, particularly with respect tofunctionality described in this disclosure. For example, application 407can serve as one or more components, modules, applications, etc.Further, although illustrated as a single application 407, theapplication 407 may be implemented as multiple applications 407 on thecomputer 402. In addition, although illustrated as integral to thecomputer 402, in alternative implementations, the application 407 can beexternal to the computer 402.

There may be any number of computers 402 associated with, or externalto, a computer system containing computer 402, each computer 402communicating over network 430. Further, the term “client,” “user,” andother appropriate terminology may be used interchangeably, asappropriate, without departing from the scope of this disclosure.Moreover, this disclosure contemplates that many users may use onecomputer 402, or that one user may use multiple computers 402.

Implementations of the subject matter and the functional operationsdescribed in this disclosure can be implemented in digital electroniccircuitry, in tangibly embodied computer software or firmware, incomputer hardware, including the structures disclosed in this disclosureand their structural equivalents, or in combinations of one or more ofthem. Implementations of the subject matter described in this disclosurecan be implemented as one or more computer programs, that is, one ormore modules of computer program instructions encoded on a tangible,non-transitory computer-storage medium for execution by, or to controlthe operation of, data processing apparatus. Alternatively or inaddition, the program instructions can be encoded on an artificiallygenerated propagated signal, for example, a machine-generatedelectrical, optical, or electromagnetic signal that is generated toencode information for transmission to suitable receiver apparatus forexecution by a data processing apparatus. The computer-storage mediumcan be a machine-readable storage device, a machine-readable storagesubstrate, a random or serial access memory device, or a combination ofcomputer-storage mediums.

The terms “data processing apparatus,” “computer,” or “electroniccomputer device” (or equivalent as understood by one of ordinary skillin the art) refer to data processing hardware and encompass all kinds ofapparatus, devices, and machines for processing data, including by wayof example, a programmable processor, a computer, or multiple processorsor computers. The apparatus can also be or further include specialpurpose logic circuitry, for example, a central processing unit (CPU),an FPGA (field programmable gate array), or an ASIC(application-specific integrated circuit). In some implementations, thedata processing apparatus or special purpose logic circuitry (or acombination of the data processing apparatus or special purpose logiccircuitry) may be hardware- or software-based (or a combination of bothhardware- and software-based). The apparatus can optionally include codethat creates an execution environment for computer programs, forexample, code that constitutes processor firmware, a protocol stack, adatabase management system, an operating system, or a combination ofexecution environments. The present disclosure contemplates the use ofdata processing apparatuses with or without conventional operatingsystems, for example, UNIX, WINDOWS, MAC OS, ANDROID, MS, or any othersuitable conventional operating system.

A computer program, which may also be referred to or described as aprogram, software, a software application, a module, a software module,a script, or code, can be written in any form of programming language,including compiled or interpreted languages, or declarative orprocedural languages, and it can be deployed in any form, including as astand-alone program or as a module, component, subroutine, or other unitsuitable for use in a computing environment. A computer program may, butneed not, correspond to a file in a file system. A program can be storedin a portion of a file that holds other programs or data, for example,one or more scripts stored in a markup language document, in a singlefile dedicated to the program in question, or in multiple coordinatedfiles, for example, files that store one or more modules, sub-programs,or portions of code. A computer program can be deployed to be executedon one computer or on multiple computers that are located at one site ordistributed across multiple sites and interconnected by a communicationnetwork. While portions of the programs illustrated in the variousfigures are shown as individual modules that implement the variousfeatures and functionality through various objects, methods, or otherprocesses, the programs may instead include a number of sub-modules,third-party services, components, libraries, and such, as appropriate.Conversely, the features and functionality of various components can becombined into single components, as appropriate.

The processes and logic flows described in this disclosure can beperformed by one or more programmable computers, executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows can also be performedby, and apparatus can also be implemented as, special purpose logiccircuitry, for example, a CPU, an FPGA, or an ASIC.

Computers suitable for the execution of a computer program can be basedon general or special purpose microprocessors, both, or any other kindof CPU. Generally, a CPU will receive instructions and data from aread-only memory (ROM) or a random access memory (RAM) or both. Theessential elements of a computer are a CPU, for performing or executinginstructions, and one or more memory devices for storing instructionsand data. Generally, a computer will also include, or be operativelycoupled to, receive data from or transfer data to, or both, one or moremass storage devices for storing data, for example, magnetic,magneto-optical disks, or optical disks. However, a computer need nothave such devices. Moreover, a computer can be embedded in anotherdevice, for example, a mobile telephone, a personal digital assistant(PDA), a mobile audio or video player, a game console, a globalpositioning system (GPS) receiver, or a portable storage device, forexample, a universal serial bus (USB) flash drive, to name just a few.

Computer-readable media (transitory or non-transitory, as appropriate)suitable for storing computer program instructions and data include allforms of non-volatile memory, media and memory devices, including by wayof example semiconductor memory devices, for example, erasableprogrammable read-only memory (EPROM), electrically erasableprogrammable read-only memory (EEPROM), and flash memory devices;magnetic disks, for example, internal hard disks or removable disks;magneto-optical disks; and CD-ROM, DVD+/−R, DVD-RAM, and DVD-ROM disks.The memory may store various objects or data, including caches; classes,frameworks; applications, backup data, jobs; web pages, web pagetemplates, database tables, repositories storing dynamic information,and any other appropriate information including any parameters,variables, algorithms, instructions, rules, constraints, or referencesthereto. Additionally, the memory may include any other appropriatedata, such as logs, policies, security or access data, reporting files,as well as others. The processor and the memory can be supplemented by,or incorporated in, special purpose logic circuitry.

To provide for interaction with a user, implementations of the subjectmatter described in this disclosure can be implemented on a computerhaving a display device, for example, a CRT (cathode ray tube), LCD(liquid crystal display), LED (Light Emitting Diode), or plasma monitor,for displaying information to the user and a keyboard and a pointingdevice, for example; a mouse, trackball, or trackpad by which the usercan provide input to the computer. Input may also be provided to thecomputer using a touchscreen, such as a tablet computer surface withpressure sensitivity, a multi-touch screen using capacitive or electricsensing, or other type of touchscreen. Other kinds of devices can beused to provide for interaction with a user as well; for example,feedback provided to the user can be any form of sensory feedback, forexample; visual feedback, auditory feedback, or tactile feedback; andinput from the user can be received in any form, including acoustic,speech, or tactile input. In addition, a computer can interact with auser by sending documents to and receiving documents from a device thatis used by the user; for example, by sending web pages to a web browseron a user's client device in response to requests received from the webbrowser.

The term “graphical user interface,” or “GUI,” may be used in thesingular or the plural, to describe one or more graphical userinterfaces and each of the displays of a particular graphical userinterface. Therefore, a GUI may represent any graphical user interface,including but not limited to, a web browser, a touch screen, or acommand line interface (CLI) that processes information and efficientlypresents the information results to the user. In general, a GUI mayinclude a plurality of user interface (UI) elements, some or allassociated with a web browser, such as interactive fields, pull-downlists, and buttons operable by the business suite user. These and otherUI elements may be related to or represent the functions of the webbrowser.

Implementations of the subject matter described in this disclosure canbe implemented in a computing system that includes a back-end component,for example, as a data server, or that includes a middleware component,for example, an application server, or that includes a front-endcomponent, for example, a client computer having a graphical userinterface or a Web browser through which a user can interact with animplementation of the subject matter described in this disclosure, orany combination of one or more such back-end, middleware, or front-endcomponents. The components of the system can be interconnected by anyform or medium of wireline or wireless digital data communication (or acombination of data communication), for example; a communicationnetwork. Examples of communication networks include a local area network(LAN), a radio access network (RAN), a metropolitan area network (MAN),a wide area network (WAN), Worldwide Interoperability for MicrowaveAccess (WIMAX), a wireless local area network (WLAN) using, for example;802.11 a/b/g/n or 802.20 (or a combination of 802.11x and 802.20 orother protocols consistent with this disclosure), all or a portion ofthe Internet, or any other communication system or systems at one ormore locations (or a combination of communication networks). The networkmay communicate with, for example, Internet Protocol (IP) packets, FrameRelay frames, Asynchronous Transfer Mode (ATM) cells, voice, video,data, or other suitable information (or a combination of communicationtypes) between network addresses.

The computing system can include clients and servers. A client andserver are generally remote from each other and typically interactthrough a communication network. The relationship of client and serverarises by virtue of computer programs running on the respectivecomputers and having a client-server relationship to each other.

In some implementations, any or all of the components of the computingsystem, both hardware or software (or a combination of hardware andsoftware), may interface with each other or the interface using anapplication programming interface (API) or a service layer (or acombination of API and service layer). The API may includespecifications for routines, data structures, and object classes. TheAPI may be either computer language independent or dependent and referto a complete interface, a single function, or even a set of APIs. Theservice layer provides software services to the computing system. Thefunctionality of the various components of the computing system may beaccessible for all service consumers using this service layer. Softwareservices provide reusable, defined business functionalities through adefined interface. For example, the interface may be software written inJAVA, C++, or other suitable language providing data in extensiblemarkup language (XML) format or other suitable format. The API orservice layer (or a combination of the API and the service layer) may bean integral or a stand-alone component in relation to other componentsof the computing system. Moreover, any or all parts of the service layermay be implemented as child or sub-modules of another software module,enterprise application, or hardware module without departing from thescope of this disclosure.

Thus, particular implementations of the subject matter have beendescribed. Other implementations are within the scope of the followingclaims.

The invention claimed is:
 1. A computer-implemented method in a wellsystem comprising a plurality of downhole valves, each downhole valvepositioned below a surface and in a wellbore included in the wellsystem, each downhole valve controlling flow of well fluid through thewellbore: detecting a change in a valve line pressure of a firstdownhole value of the plurality of downhole valves; determining, inresponse to detecting the change in the valve line pressure, whether thechange is due to a planned maintenance; performing, in response todetermining that the change is not due to a planned maintenance, adiagnostic test on the first downhole valve, the diagnostic testcomprising: receiving, at a first time and by one or more processors,first diagnostics data of the first downhole valve of the plurality ofdownhole valves, wherein the first diagnostics data represents: (i) afirst valve condition of the downhole valve at a first valve positionand at the first time, and (ii) a first well head pressure at thesurface of the well system for the first downhole valve at the firstvalve position and at the first time; causing the first downhole valveto move from the first valve position to a second valve position;receiving, at a second time and by the one or more processors, seconddiagnostics data of the first downhole valve, wherein the seconddiagnostics data represents: (i) a second valve condition of thedownhole valve at the second valve position and at the second time, and(ii) second well head pressure at the surface of the well system for thefirst downhole valve at the second valve position and at the secondtime; comparing, by the one or more processors, the first diagnosticsdata and the second diagnostics data; and based on results of comparingthe first diagnostics data and the second diagnostics data, selecting,by the one or more processors, a valve maintenance operation for thefirst downhole valve.
 2. The computer-implemented method of claim 1,further comprising: after collecting the second diagnostics data of thefirst downhole valve at the second valve position, returning the firstdownhole valve to the first valve position.
 3. The computer-implementedmethod of claim 1, further comprising: receiving, at a third time and bythe one or more processors, third diagnostics data of the first downholevalve, wherein the first downhole valve is at the first valve positionat the third time, and the third diagnostics data represents a thirdvalve condition of the first downhole valve at the first valve positionand at the third time; causing the first downhole valve to move from thefirst valve position to the second valve position; receiving, at afourth time and by the one or more processors, fourth diagnostics dataof the first downhole valve, wherein the fourth diagnostics datarepresents a fourth valve condition of the first downhole valve at thesecond valve position and at the fourth time; comparing, by the one ormore processors, the first diagnostics data and the third diagnosticsdata; comparing, by the one or more processors, the second diagnosticsdata and the fourth diagnostics data; and based on results of comparingthe first diagnostics data and the third diagnostics data and comparingthe second diagnostics data and the fourth diagnostics data, scheduling,by the one or more processors, a second valve maintenance operation forthe first valve at a future time.
 4. The computer-implemented method ofclaim 3, further comprising: determining a reliability for the firstdownhole valve based on the results of comparing the first diagnosticsdata and the third diagnostics data and comparing the second diagnosticsdata and the fourth diagnostics data, wherein the reliability indicatesa probability that the first downhole valve would fail during apredetermined duration of time; and determining the respective futuretime for the second valve maintenance operation for the first downholevalve based on the reliability.
 5. The computer-implemented method ofclaim 3, wherein for the first downhole valve the third time is threemonths from the first time, and the fourth time is three months from thesecond time.
 6. The computer-implemented method of claim 1, wherein theplurality of downhole valves are choke valves.
 7. Thecomputer-implemented method of claim 1, wherein the first and seconddiagnostics data further includes at least one of: valve attribute dataincluding at least one of valve position, line pressure, or a fluid flowrate through the first downhole valve, the valve position including atleast one of an open or a closed position, and the line pressureincluding a well fluid pressure in a flow path controlled by the firstdownhole valve; well production attribute data including well fluidproduction rate through the wellbore; or fault detection attribute dataindicating at least one of leakage in a valve actuator, looseness in avalve assembly, or a hydraulic failure in the first downhole valve. 8.The computer-implemented method of claim 1, wherein comparing the firstdiagnostics data to the second diagnostics data comprises performing acorrelation operation on the first diagnostics data and the seconddiagnostics data.
 9. The computer-implemented method of claim 1, whereinthe valve maintenance operation is at least one of replacing the firstdownhole valve, stopping flow of well fluid through the first downholevalve, repairing the first downhole valve, or capturing the diagnosticdata.
 10. The computer-implemented method of claim 1, furthercomprising: for the first downhole valve, storing the first valveposition, the first time, the second valve position, and the secondtime; and providing an alert based on the results of comparing the firstdiagnostics data and the second diagnostics data.
 11. Thecomputer-implemented method of claim 1, wherein the well system is amultilateral well comprising a mother wellbore and multiple lateralwellbores, the mother wellbore and each lateral wellbore comprising atleast one of the plurality of downhole valves.
 12. Thecomputer-implemented method of claim 1, further comprising: based onresults of comparing the first diagnostics data and the seconddiagnostics data, adjusting, by the one or more processors, a frequencyof capturing diagnostic data.
 13. A non-transitory, computer-readablemedium storing one or more instructions executable by a computer systemto perform operations in a well system comprising a plurality ofdownhole valves, each downhole valve positioned below a surface and in awellbore included in the well system, each downhole valve controllingflow of well fluid through the wellbore, the operations comprising:detecting a change in a valve line pressure of a first downhole value ofthe plurality of downhole valves; determining, in response to detectingthe change in the valve line pressure, whether the change is due to aplanned maintenance; performing, in response to determining that thechange is not due to a planned maintenance, a diagnostic test on thefirst downhole valve, the diagnostic test comprising: receiving, at afirst time and by one or more processors, first diagnostics data of thefirst downhole valve of the plurality of downhole valves, wherein thefirst diagnostics data represents: (i) a first valve condition of thedownhole valve at a first valve position and at the first time, and (ii)a first well head pressure at the surface of the well system for thefirst downhole valve at the first valve position and at the first time;causing the first downhole valve to move from the first valve positionto a second valve position; receiving, at a second time and by the oneor more processors, second diagnostics data of the first downhole valve,wherein the second diagnostics data represents: (i) a second valvecondition of the first downhole valve at the second valve position andat the second time, and (ii) second well head pressures at the surfaceof the well system for the first downhole valve at the second valveposition and at the second time; comparing the first diagnostics dataand the second diagnostics data; and based on results of comparing thefirst diagnostics data and the second diagnostics data, selecting avalve maintenance operation for the first downhole valve.
 14. Thenon-transitory, computer-readable medium of claim 13, the operationsfurther comprising: causing the first downhole valve to move from thesecond valve position to the first valve position; receiving, at a thirdtime and by the one or more processors, third diagnostics data of thefirst downhole valve, wherein the first downhole valve is at the firstvalve position at a third time, and the third diagnostics datarepresents a third valve condition of the first downhole valve at thefirst valve position and at the third time; causing the first downholevalve to move from the first valve position to the second valveposition; receiving, at a fourth time and by the one or more processors,fourth diagnostics data of the first downhole valve, wherein the fourthdiagnostics data represents a fourth valve condition of the firstdownhole valve at the second valve position and at the fourth time;comparing the first diagnostics data and the third diagnostics data;comparing the second diagnostics data and the fourth diagnostics data;and based on results of comparing the first diagnostics data and thethird diagnostics data and comparing the second diagnostics data and thefourth diagnostics data, scheduling a second valve maintenance operationfor the first downhole valve at a future time.
 15. The non-transitory,computer-readable medium of claim 14, the operations further comprising:determining a reliability for the first downhole valve based on theresults of comparing the first diagnostics data and the thirddiagnostics data and comparing the second diagnostics data and thefourth diagnostics data, wherein the reliability indicates a probabilitythat the first downhole valve would fail during a predetermined durationof time; and determining the future time for the second valvemaintenance operation for downhole valve based on the reliability. 16.The non-transitory, computer-readable medium of claim 13, wherein thefirst and second diagnostics data further includes at least one of:valve attribute data including at least one of valve position, linepressure, or a fluid flow rate through the first downhole valve, thevalve position including at least one of an on or off position, and theline pressure including a well fluid pressure in a flow path controlledby the first downhole valve; well production attribute data includingwell fluid production rate through the wellbore; or fault detectionattribute data indicating at least one of leakage in a valve actuator,looseness in a valve assembly or connection, or a hydraulic failure inthe first downhole valve.
 17. A system, comprising: a computer memory;and a hardware processor interoperably coupled with the computer memoryand configured to perform operations in a well system comprising aplurality of downhole valves, each downhole valve positioned below asurface and in a wellbore included in the well system, each downholevalve controlling flow of well fluid through the wellbore, theoperations comprising: detecting a change in a valve line pressure of afirst downhole value of the plurality of downhole valves; determining,in response to detecting the change in the valve line pressure, whetherthe change is due to a planned maintenance; performing, in response todetermining that the change is not due to a planned maintenance, adiagnostic test on the first downhole valve, the diagnostic testcomprising: receiving, at a first time and by one or more processors,first diagnostics data of the first downhole valve of the plurality ofdownhole valves, wherein the first diagnostics data represents: (i) afirst valve condition of the first downhole valve at a first valveposition and at the first time, and (ii) a first well head pressure atthe surface of the well system for the first downhole valve at the firstvalve position and at the first time; causing the first downhole valveto move from the first valve position to a second valve position;receiving, at a second time and by the one or more processors, seconddiagnostics data of the first downhole valve, wherein the seconddiagnostics data represents: (i) a second valve condition of the firstdownhole valve at the second valve position and at the second time, and(ii) a second well head pressure at the surface of the well system forthe first downhole valve at the second valve position and at the secondtime; comparing the first diagnostics data and the second diagnosticsdata; and based on results of comparing the first diagnostics data andthe second diagnostics data, selecting a valve maintenance operation forthe first downhole valve.
 18. The system of claim 17, wherein theoperations further comprise: causing the first downhole valve to movefrom the second valve position to the first valve position; receiving,at a third time and by the one or more processors, third diagnosticsdata of the first downhole valve, wherein the first downhole valve is atthe first valve position at a third time, and the third diagnostics datarepresents a third valve condition of the first downhole valve at thefirst valve position and at the third time; causing the first downholevalve to move from the first valve position to the second valveposition; receiving, at a fourth time and by the one or more processors,fourth diagnostics data of the first downhole valve, wherein the fourthdiagnostics data represents a fourth valve condition of the firstdownhole valve at the second valve position and at the fourth time;comparing the first diagnostics data and the third diagnostics data;comparing the second diagnostics data and the fourth diagnostics data;and based on results of comparing the first diagnostics data and thethird diagnostics data and comparing the second diagnostics data and thefourth diagnostics data, scheduling a second valve maintenance operationfor the first downhole valve at a future time.
 19. The system of claim18, the operations further comprising: determining a reliability for thefirst downhole valve based on the results of comparing the firstdiagnostics data and the third diagnostics data and comparing the seconddiagnostics data and the fourth diagnostics data, wherein thereliability indicates a probability that the valve would fail during apredetermined duration of time; and determining the future time for thesecond valve maintenance operation for the first downhole valve based onthe reliability.
 20. The system of claim 17, wherein the system furthercomprises multiple sensors disposed at multiple locations in thewellbore, and wherein the first and second diagnostics data isdetermined based on information sensed by the multiple sensors.
 21. Thesystem of claim 17, wherein the first and second diagnostics datafurther includes at least one of: valve attribute data including atleast one of valve position, line pressure, or a fluid flow rate throughthe first downhole valve, the valve position including at least one ofan open or a closed position, and the line pressure including a wellfluid pressure in a flow path controlled by the first downhole valve;well production attribute data including well fluid production ratethrough the wellbore; or fault detection attribute data indicating atleast one of leakage in a valve actuator, looseness in a valve assembly,or a hydraulic failure in the first downhole valve.